<?php


class Player
{
	public $id;
	public $firstName;
	public $lastName;
	public $nflTeam;
	public $position;
	public $rank;
	
	public function __construct($id, $firstName, $lastName, $position, $rank, $nflTeam)
	{
		$this->id = $id;
		$this->firstName = $firstName;
		$this->lastName = $lastName;
		$this->position = $position;
		$this->rank = $rank;
		$this->nflTeam = $nflTeam;
	}
	
	public function setTeam($nflTeamID, $nflTeamArray)
	{
		foreach ($nflTeamArray as $team)
		{
			if ($team->id == $nflTeamID)
			{
				$this->nflTeam = $team;
			}
		}
	}
	
	public function getDisplayFormat()
	{
		$template = "<tr id='".$this->id."' name='".$this->firstName." ".$this->lastName."' class='player ".$this->position."'>";
			$template = $template . "<td>" . $this->rank . "</td>";
			$template = $template . "<td><img src='images/teams2/".$this->nflTeam->shortName.".png' atl='NFL' width='45' height='30'/></td>";
			$template = $template . "<td>". $this->firstName . " " . $this->lastName."</td>";
			$template = $template . "<td>" . strtoupper($this->position) . "</td>";
		$template = $template . "</tr>";
		$template = $template . "<tr class='separator ".$this->position."'><td/><td/><td/><td/></tr>";
		
		return $template;
	}
	
	
	
	public function __toString()
	{
		return $this->firstName." ".$this->lastName." - ".strtoupper($this->position);
	}
}



?>